import com.sun.org.apache.xpath.internal.operations.String;

import java.util.Scanner;

public class Test_Player {
    public static void main(String[] args) {
        Player player = new Player(9, 9, "玩家");
        player.show();
        Princess princess = new Princess( "玩家");
        princess.show();

        Player players[] = new Player[5];
        players[0] = new Monster("怪物1");
        players[1] = new Monster("怪物2");
        players[2] = new Monster("怪物3");

        players[3] = new Player(9, 9, "玩家");
        players[4] = new Princess("公主");
        while (true) {

            System.out.println("请输入您要移动的方向：");
            Scanner sc = new Scanner(System.in);
            player.move(sc.next().charAt(0));
            princess.move();




            int p=0;
            for (int i = 0; i < 3; i++) {

                players[i].show();
                if (player.x == players[i].x && player.y == players[i].y) {
                    System.out.println("玩家和" + players[i].name + "相遇，游戏结束");
                    p=-1;
                    break;
                }
            }
            if(p==-1)
                break;
            if (player.x == princess.x && player.y == princess.y) {
                System.out.println("玩家和公主相遇，游戏结束");
                break;
            }
        }
    }
}
